package com.github.freegeese.autocode.configuration;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

/**
 * Created by Administrator on 2017/3/30.
 */
public class Configuration {

    private static Configuration instance = new Configuration();

    private List<TableConfig> tableConfigs = new ArrayList<>();
    private File outputDirectory;
//    private String domainPa

    private Configuration() {
    }

    public static Configuration getInstance() {
        return instance;
    }

    public Configuration addTableConfig(TableConfig tableConfig) {
        this.tableConfigs.add(tableConfig);
        return this;
    }

    public Configuration addTableConfig(TableConfig first, TableConfig second, TableConfig... more) {
        List<TableConfig> tableConfigs = new ArrayList<>();
        tableConfigs.add(first);
        tableConfigs.add(second);
        if (null != more) {
            tableConfigs.addAll(Arrays.asList(more));
        }
        addTableConfigs(tableConfigs);
        return this;
    }

    public Configuration addTableConfigs(Collection<TableConfig> tableConfigs) {
        this.tableConfigs.addAll(tableConfigs);
        return this;
    }

    public List<TableConfig> getTableConfigs() {
        return tableConfigs;
    }

    public void setTableConfigs(List<TableConfig> tableConfigs) {
        this.tableConfigs = tableConfigs;
    }
}
